package com.sws.orderMS.pojo;

import java.util.List;

public class ShoppingCart {

	private List<OrderItem> orderList;
	
	public ShoppingCart() {
	}

	public List<OrderItem> getOrderList() {
		return orderList;
	}

	public void setOrderlist(List<OrderItem> orderList) {
		this.orderList = orderList;
	}
	
	public boolean isEmpty() {
		return orderList.isEmpty();
	}
	
	public int getItemNum() {
		int num = 0;
		for (OrderItem item: orderList) {
			num = num + item.getAmount();
		}
		return num;
	}
	
	public void addItem(OrderItem item) {
		orderList.add(item);
	}
	
	public boolean removeItem(OrderItem item) {
		return orderList.remove(item);
	}
	
	public void removeAll() {
		orderList.removeAll(orderList);
	}
	
	public void clean() {
		
	}
	
}
